//
//  UIColor+SQColor.m
//  自定义转场测试
//
//  Created by 翁胜琼 on 2018/3/5.
//  Copyright © 2018年 翁胜琼. All rights reserved.
//

#import "UIColor+SQColor.h"

@implementation UIColor (SQColor)

+ (instancetype)SQColorWithRed:(UInt8) red green:(UInt8) green blue:(UInt8) blue
{
    return [UIColor colorWithRed:red / 255.0 green:green / 255.0 blue:blue / 255.0 alpha:1.0];
}

+ (instancetype)SQRandomColor
{
    return [self SQColorWithRed:arc4random_uniform(256) green:arc4random_uniform(256)  blue:arc4random_uniform(256)];
}

+ (instancetype)SQColorWithHex:(UInt32)hex
{
    UInt8 red = (hex & 0xff0000) << 16;
    UInt8 green = (hex & 0x00ff00) << 8;
    UInt8 blue = hex & 0x0000ff;

    return [self SQColorWithRed:red green:green blue:blue];
}

@end
